window.workspace = function(){
	var response  = <?#$respons?>;
	var store, grid;
	var sid = {'sdate':Ext.id(), 'stype':Ext.id(), 'edate':Ext.id()};
	store = new Ext.data.JsonStore({
	    autoDestroy	: true,
	    url			: '/admin/live/stat/platformstats/dolist.html',
	    remoteSort	: true,
	    sortInfo	: {
	            field		: 'id',
	            direction	: 'DESC'
		},
		baseParams	: {
			start	: 0,
			stype	: 1,
			limit	: main.pageSize
		},
		autoLoad		: true,
	    root			: 'dataset',
	 	totalProperty	: 'total',
	    fields			: ['id', 'register', 'login', 'live_num', 'live_time', 'remain_coin', 'remain_earn', 'cost_count', 'avertime', 'averviewer',
	         'cost_num', 'charge_count', 'charge_num', 'charge_total_count', 'charge_total_num', 'charge_total_web', 'charge_total_android', 'charge_total_ios', 'day', 'stime']
	});
	
 	grid = {
		xtype		: 'grid',
		title		: response.title,
	    store		: store,
		region		: 'center', 
	    columns		: [
			{header: 'ID', width:60, sortable:true, dataIndex:'id'},
			{header: 'Register(注册数)', width:60, sortable:true, dataIndex:'register'},
			{header: 'Login(登录数)', width:60, sortable:true, dataIndex:'login'},
			{header: 'LiveUser(直播人数)', width:60, sortable:true, dataIndex:'live_num'},
			{header: 'LiveTime(直播总时长)', width:60, sortable:true, dataIndex:'live_time'},
			{header: 'CostCoin(消费新币)', width:60, sortable:true, dataIndex:'cost_count'},
			{header: 'CostUser(消费人数)', width:60, sortable:true, dataIndex:'cost_num'},
			{header: 'PayMoney(充值金额)', width:60, sortable:true, dataIndex:'charge_count'},
			{header: 'ChargeUser(充值人数)', width:80, sortable:true, dataIndex:'charge_num'},
			{header: 'PayTotalMoney(总充值金额)', width:80, sortable:true, dataIndex:'charge_total_count'},
			{header: 'PayTotalWeb(web总充值金额)', width:80, sortable:true, dataIndex:'charge_total_web'},
			{header: 'PayTotalAndroid(安卓总充值金额)', width:80, sortable:true, dataIndex:'charge_total_android'},
			{header: 'PayTotalIos(苹果总充值金额)', width:80, sortable:true, dataIndex:'charge_total_ios'},
			{header: 'PayTotalUser(总充值人数)', width:80, sortable:true, dataIndex:'charge_total_num'},
			{header: 'RemainCoin(全部用户剩余新币)', width:80, sortable:true, dataIndex:'remain_coin'},
			{header: 'RemainEarn(全部主播剩余收益没领取)', width:80, sortable:true, dataIndex:'remain_earn'},
			{header: 'Avertime(平均观看时长)', width:80, sortable:true, dataIndex:'avertime'},
			{header: 'Averviewer(平均观看人数)', width:80, sortable:true, dataIndex:'averviewer'},
			{header: 'Day/Week/Month', width:60, sortable:true, dataIndex:'day'},
			{header: 'AddTime', width:100, sortable:true, dataIndex:'stime'}
		],
	    viewConfig	: {
	        forceFit	 : true,
	        scrollOffset : 0
	    },
	    sm			: new Ext.grid.RowSelectionModel({singleSelect:true}),
	    stripeRows	: true,
	    tbar		: [{
			text	: 'Reload',
			iconCls	: 'icon-refresh',
			handler : function(){
				store.reload(); 
			}
	    },'-','<b>Search For：</b>','-','Day/Week/Month:',{
    		xtype		: 'combo',
            store		: new Ext.data.ArrayStore({
            	fields: ['id', 'name'],
            	data  : [[1, 'Day'], [2, 'Week'], [3, 'Month']]
            }),
			displayField	: 'name',
			valueField		: 'id',
			emptyText		: 'Selected...',
            width			: 100,
            value           : 1,
			triggerAction	: 'all',
			id      		: sid.stype,
			mode			: 'local'
        },'-',{
			text		: 'Do Search',
			iconCls		: 'icon-search',
			handler: function() {
				store.baseParams.stype  = Ext.getCmp(sid.stype).getValue();
				store.reload(); 
			}
		},'-',{
			text			: '导出',
			iconCls			: 'icon-search',
			url			    : '/admin/live/stat/platformstats/doexport.html',
			handler: function() {
				stype  = Ext.getCmp(sid.stype).getValue();
				param   = '?stype='+stype+'&sort=id&dir=DESC';
				window.location.href = '/admin/live/stat/platformstats/doexport.html'+param;
			}
		}],
		bbar		: new Ext.PagingToolbar({
			pageSize	: main.pageSize,
			store		: store,
			displayInfo	: true
		})
	};
	return grid;
}();